<?php
use yii\helpers\Url;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script type="text/javascript" src="/js/ajax141212.js"></script>
<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
</head>

<body>
login<br>


用户名：<input id="username" type="text" value="admin"/><br>
密　码：<input id="password" type="password"/><br>
<input id="_token" type="hidden" value="">

<input id="loginButton" type="button" value="login"/>


<script language="javascript">

document.getElementById("loginButton").onclick = function(){
	
	var _token = $("#_token").val();
	
	var username = $("#username").val();
	var password = $("#password").val();
	
	new Ajax().post({
		url : "<?php echo Url::to(["login/async-login"])?>",
		data : "_token="+_token+"&username="+username+"&password="+password,
		resultType : 'json',
		onLoaded : function(result){
			if(result.code == 1){
				window.location.href = "<?php echo Url::to(["note/list"])?>";
			}else{
				alert(result.info);	
			}
		}
	});
	
	
}


</script>

</body>
</html>
